#pragma once
#include "Runtime/BattleFirePrefix.h"
namespace Alice{
    struct Uint128_64
    {
        inline Uint128_64(uint64 InLo, uint64 InHi) : lo(InLo), hi(InHi) {}
        uint64 lo;
        uint64 hi;
    };

    // Hash function for a byte array.
    uint64 CityHash64(const char *buf, uint32 len);

    // Hash function for a byte array.  For convenience, a 64-bit seed is also
    // hashed into the result.
    uint64 CityHash64WithSeed(const char *buf, uint32 len, uint64 seed);

    // Hash function for a byte array.  For convenience, two seeds are also
    // hashed into the result.
    uint64 CityHash64WithSeeds(const char *buf, uint32 len,
        uint64 seed0, uint64 seed1);

    // Hash function for a byte array.  Most useful in 32-bit binaries.
    uint32 CityHash32(const char *buf, uint32 len);

    // Hash 128 input bits down to 64 bits of output.
    // This is intended to be a reasonably good hash function.
    inline uint64 CityHash128to64(const Uint128_64& x) {
        // Murmur-inspired hashing.
        const uint64 kMul = 0x9ddfea08eb382d69ULL;
        uint64 a = (x.lo ^ x.hi) * kMul;
        a ^= (a >> 47);
        uint64 b = (x.hi ^ a) * kMul;
        b ^= (b >> 47);
        b *= kMul;
        return b;
    }
}